<?php 
error_reporting(0); 
require 'class.JavaScriptPacker.php';
if (!empty($_FILES['source_file'])) { 
    $_POST['encoding'] = isset($_POST['encoding']) ? (int) $_POST['encoding'] : 62; 
    $_POST['fastdecode'] = isset($_POST['fastdecode']) ? (bool) $_POST['fastdecode'] : true; 
    $_POST['specialchars'] = isset($_POST['specialchars']) ? (bool) $_POST['specialchars'] : true;

    $packer = new JavaScriptPacker(file_get_contents($_FILES['source_file']['tmp_name']), $_POST['encoding'], $_POST['fastdecode'], $_POST['specialchars']);

    if (preg_match('/^(.*)\.js$/i', $_FILES['source_file']['name'], $matches) == 0) { 
        $matches = array('none.js', 'none'); 
    }

    header('Content-Type: application/x-javascript', true); 
    header('Content-Disposition: attachment; filename='.$matches[1].'_packed.js'); 
    echo $packer->pack(); 
    exit; 
} 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>JavaScript Packer</title> 
</head> 
<body> 
<form action="" method="post" enctype="multipart/form-data" name="file_form" id="file_form"> 
  <input type="file" name="source_file" id="source_file" /> 
  <select name="encoding" id="encoding"> 
    <option value="0">None</option> 
    <option value="10">Numeric</option> 
    <option value="62" selected="selected">Normal</option> 
    <option value="95">High ASCII</option> 
  </select> 
  <input type="checkbox" name="fastdecode" value="true" id="fastdecode" /> 
  <label for="fastdecode">fast deconde</label> 
  <input type="checkbox" name="specialchars" value="true" id="specialchars" /> 
  <label for="specialchars">special characters</label> 
  <input type="submit" name="submit_button" value="start pack" id="submit_button" /> 
</form> 
</body> 
</html> 